package com.nfc.base.Entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Type;

@Entity
@Table(name="staff")
public class Staff {

	private int staff_id;

	private Staff created_by;

	private Date created_on;

	private Staff changed_by;

	private Date changed_on;

	private String fname;
	private String mname;
	private String lname;
	private String nationality;

	private Date dob;
	private String live_in;
	private Date join_on;
	private String job_title;
	

	@Id
	@Column(name="staff_id", unique = true, nullable = false)
	@SequenceGenerator(name="staff_staff_id_seq", sequenceName="staff_staff_id_seq")
	@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="staff_staff_id_seq")
	public int getStaff_id() {
		return staff_id;
	}
	public void setStaff_id(int staff_id) {
		this.staff_id = staff_id;
	}
	
	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="created_by")
	public Staff getCreated_by() {
		return created_by;
	}
	public void setCreated_by(Staff created_by) {
		this.created_by = created_by;
	}
	

	@Column(name="created_on")	
	@Type(type="date")
	@Temporal(TemporalType.DATE)
	public Date getCreated_on() {
		return created_on;
	}
	public void setCreated_on(Date created_on) {
		this.created_on = created_on;
	}
	

	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="changed_by")
	public Staff getChanged_by() {
		return changed_by;
	}
	public void setChanged_by(Staff changed_by) {
		this.changed_by = changed_by;
	}
	

	@Column(name="changed_on")	
	@Type(type="date")
	@Temporal(TemporalType.DATE)
	public Date getChanged_on() {
		return changed_on;
	}
	public void setChanged_on(Date changed_on) {
		this.changed_on = changed_on;
	}
	
	@Column(name="fname")
	public String getFname() {
		return fname;
	}
	public void setFname(String fname) {
		this.fname = fname;
	}
	@Column(name="mname")
	public String getMname() {
		return mname;
	}
	public void setMname(String mname) {
		this.mname = mname;
	}
	@Column(name="lname")
	public String getLname() {
		return lname;
	}
	public void setLname(String lname) {
		this.lname = lname;
	}
	@Column(name="nationality")
	public String getNationality() {
		return nationality;
	}
	public void setNationality(String nationality) {
		this.nationality = nationality;
	}

	@Column(name="dob")	
	@Type(type="date")
	@Temporal(TemporalType.DATE)
	public Date getDob() {
		return dob;
	}
	public void setDob(Date dob) {
		this.dob = dob;
	}
	@Column(name="live_in")
	public String getLive_in() {
		return live_in;
	}
	public void setLive_in(String live_in) {
		this.live_in = live_in;
	}

	@Column(name="join_on")	
	@Type(type="date")
	@Temporal(TemporalType.DATE)
	public Date getJoin_on() {
		return join_on;
	}
	public void setJoin_on(Date join_on) {
		this.join_on = join_on;
	}
	@Column(name="job_title")
	public String getJob_title() {
		return job_title;
	}
	public void setJob_title(String job_title) {
		this.job_title = job_title;
	}

}
